Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

762
Vistas
Docker fails to build in Azure Pipelines with "error MSB1001"

Am facing strange issue. When i build my Dockerfile on windows machine(Laptop) getting below error and also getting same error when i tried to deploy on Azure DevOps.

Step 7/17 : COPY ["WebApp.csproj", ""]
 ---> 3f3e198d00aa
Step 8/17 : RUN dotnet restore "/WebApp.csproj"
 ---> Running in 51f16f947ffb
MSBUILD : error MSB1001: Unknown switch.
Switch: /WebApp.csproj

For switch syntax, type "MSBuild -help"
The command '/bin/sh -c dotnet restore "/WebApp.csproj"' returned a non-zero code: 1
PS C:\Users\user\Desktop\Directory>

But the same Dockerfile works fine when we build it using visual studio it builds and starts running without any errors.

Docker file looks like:

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["WebApp.csproj", ""]
RUN dotnet restore "/WebApp.csproj"
COPY . .
WORKDIR "/src/"
RUN dotnet build "WebApp.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "WebApp.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApp.dll"]
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Because in your dotnet restore there is / so MSBuild think it's a switch (like /p:) and fails, you just need to remove it:

RUN dotnet restore "WebApp.csproj"
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda